#include "AdditiveExpr.h"
#include "MultiplicativeExpr.h"
#include <iostream>
#include <string>
#include <assert.h>

AdditiveExpr::~AdditiveExpr(void)
{
	switch(m_iType)
	{
	case single_expr:
		delete m_pSingleExpr;
		break;
	case add_expr:
	case sub_expr:
		delete m_pMulExpr;
		delete m_pAddExpr;
		break;
	default:
		std::cout<<"AdditiveExpr::~AdditiveExpr(), Unknown type!\n"<<std::endl;
		exit(1);
	}
}

void AdditiveExpr::codeGen()
{
	COUT
	switch(m_iType)
	{
	case single_expr:
		m_pSingleExpr->codeGen();
		break;
	case add_expr:
	case sub_expr:
		m_pMulExpr->codeGen();
		m_pAddExpr->codeGen();
		break;
	default:
		std::cout<<"AdditiveExpr::codeGen(), Unknown type!\n"<<std::endl;
		exit(1);
	}
}